import React, { Component } from 'react';
import 'common/containers/top.less';

/**
 * 头部标题组件
 */
class Top extends Component{
	
	//左上角返回事件
	backHandle = () => {
		this.props.backHandle();
	}
	
	//右上角工具事件
	toolHandle = () => {
		this.props.toolHandle();
	}
	
	render(){
		return(
			<div className="app_title">
				{
					this.props.topInfo.showBack && 
					<div className="app_title_left fl">
						<img src="assets/img/back.png" onClick={this.backHandle}/>
					</div>
				}
				{
					this.props.topInfo.showTool &&
					<div className="app_title_right fr">
						<img src="assets/img/tools.png" onClick={this.toolHandle}/>
					</div>
				}
				<div className="app_title_content">{this.props.topInfo.title}</div>  
			</div>
		)
	}
}

export default Top;